package com.etime.shyauth.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etime.shyauth.pojo.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * 系统用户dao层接口
 */
@Repository
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Update("update sysuser set usertruename=#{usertruename},nickname=#{nickname}," +
            "userbirthyear=#{userbirthyear},userbirthmonth=#{userbirthmonth},userbirthday=#{userbirthday}," +
            "useroccupation=#{useroccupation},usermajor=#{usermajor},userphone=#{userphone}," +
            "useremail=#{useremail},code=#{code} where userid=#{userid}")
    int updateBaseSysUser(SysUser user);

    /**
     * 修改用户的unionid
     *
     * @param user
     * @return
     */
    @Update("update sysuser set unionid=#{unionid} where userid=#{userid}")
    int updateUserUnionId(SysUser user);

    /**
     * 修改用户的从属销售人员id
     *
     * @param user
     * @return
     */
    @Update("update sysuser set saleruserid=#{saleruserid} where userid=#{userid}")
    int updateSysSaleUserId(SysUser user);
}
